import { Injectable } from '@nestjs/common';
import { DataSource } from 'typeorm';

@Injectable()
export class StatisticsService {
  constructor(private readonly dataSource: DataSource) {}

  async findStatistics() {
    const query = `
    update statistics set homepage = homepage + 1;
    `;
    await this.dataSource.query(query);
    const [res] = await this.dataSource.query(`select * from statistics`);
    return res;
  }
}
